/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package utils;

import java.awt.Color;

/**
 *
 * @author chapmand
 */
public class SRMToRGB {
    public static String getRGB(final double fullSRM){
        double srm = (double)Math.round(fullSRM * 10)/10;
        if(srm<=0.1) return "248,248,230";
        else if(srm<=0.2) return "248,248,220";
        else if(srm<=0.3) return "247,247,199";
        else if(srm<=0.4) return "244,249,185";
        else if(srm<=0.5) return "247,249,180";
        else if(srm<=0.6) return "248,249,178";
        else if(srm<=0.7) return "244,246,169";
        else if(srm<=0.8) return "245,247,166";
        else if(srm<=0.9) return "246,247,156";
        else if(srm<=1) return "243,249,147";
        else if(srm<=1.1) return "246,248,141";
        else if(srm<=1.2) return "246,249,136";
        else if(srm<=1.3) return "245,250,128";
        else if(srm<=1.4) return "246,249,121";
        else if(srm<=1.5) return "248,249,114";
        else if(srm<=1.6) return "243,249,104";
        else if(srm<=1.7) return "246,248,107";
        else if(srm<=1.8) return "248,247,99";
        else if(srm<=1.9) return "245,247,92";
        else if(srm<=2) return "248,247,83";
        else if(srm<=2.1) return "244,248,72";
        else if(srm<=2.2) return "248,247,73";
        else if(srm<=2.3) return "246,247,62";
        else if(srm<=2.4) return "241,248,53";
        else if(srm<=2.5) return "244,247,48";
        else if(srm<=2.6) return "246,249,40";
        else if(srm<=2.7) return "243,249,34";
        else if(srm<=2.8) return "245,247,30";
        else if(srm<=2.9) return "248,245,22";
        else if(srm<=3) return "246,245,19";
        else if(srm<=3.1) return "244,242,22";
        else if(srm<=3.2) return "244,240,21";
        else if(srm<=3.3) return "243,242,19";
        else if(srm<=3.4) return "244,238,24";
        else if(srm<=3.5) return "244,237,29";
        else if(srm<=3.6) return "238,233,22";
        else if(srm<=3.7) return "240,233,23";
        else if(srm<=3.8) return "238,231,25";
        else if(srm<=3.9) return "234,230,21";
        else if(srm<=4) return "236,230,26";
        else if(srm<=4.1) return "230,225,24";
        else if(srm<=4.2) return "232,225,25";
        else if(srm<=4.3) return "230,221,27";
        else if(srm<=4.4) return "224,218,23";
        else if(srm<=4.5) return "229,216,31";
        else if(srm<=4.6) return "229,214,30";
        else if(srm<=4.7) return "223,213,26";
        else if(srm<=4.8) return "226,213,28";
        else if(srm<=4.9) return "223,209,29";
        else if(srm<=5) return "224,208,27";
        else if(srm<=5.1) return "224,204,32";
        else if(srm<=5.2) return "221,204,33";
        else if(srm<=5.3) return "220,203,29";
        else if(srm<=5.4) return "218,200,32";
        else if(srm<=5.5) return "220,197,34";
        else if(srm<=5.6) return "218,196,41";
        else if(srm<=5.7) return "217,194,43";
        else if(srm<=5.8) return "216,192,39";
        else if(srm<=5.9) return "213,190,37";
        else if(srm<=6) return "213,188,38";
        else if(srm<=6.1) return "212,184,39";
        else if(srm<=6.2) return "214,183,43";
        else if(srm<=6.3) return "213,180,45";
        else if(srm<=6.4) return "210,179,41";
        else if(srm<=6.5) return "208,178,42";
        else if(srm<=6.6) return "208,176,46";
        else if(srm<=6.7) return "204,172,48";
        else if(srm<=6.8) return "204,172,52";
        else if(srm<=6.9) return "205,170,55";
        else if(srm<=7) return "201,167,50";
        else if(srm<=7.1) return "202,167,52";
        else if(srm<=7.2) return "201,166,51";
        else if(srm<=7.3) return "199,162,54";
        else if(srm<=7.4) return "198,160,56";
        else if(srm<=7.5) return "200,158,60";
        else if(srm<=7.6) return "194,156,54";
        else if(srm<=7.7) return "196,155,54";
        else if(srm<=7.8) return "198,151,60";
        else if(srm<=7.9) return "193,150,60";
        else if(srm<=8) return "191,146,59";
        else if(srm<=8.1) return "190,147,57";
        else if(srm<=8.2) return "190,147,59";
        else if(srm<=8.3) return "190,145,60";
        else if(srm<=8.4) return "186,148,56";
        else if(srm<=8.5) return "190,145,58";
        else if(srm<=8.6) return "193,145,59";
        else if(srm<=8.7) return "190,145,58";
        else if(srm<=8.8) return "191,143,59";
        else if(srm<=8.9) return "191,141,61";
        else if(srm<=9) return "190,140,58";
        else if(srm<=9.1) return "192,140,61";
        else if(srm<=9.2) return "193,138,62";
        else if(srm<=9.3) return "192,137,59";
        else if(srm<=9.4) return "193,136,59";
        else if(srm<=9.5) return "195,135,63";
        else if(srm<=9.6) return "191,136,58";
        else if(srm<=9.7) return "191,134,67";
        else if(srm<=9.8) return "193,131,67";
        else if(srm<=9.9) return "190,130,58";
        else if(srm<=10) return "191,129,58";
        else if(srm<=10.1) return "191,131,57";
        else if(srm<=10.2) return "191,129,58";
        else if(srm<=10.3) return "191,129,58";
        else if(srm<=10.4) return "190,129,55";
        else if(srm<=10.5) return "191,127,59";
        else if(srm<=10.6) return "194,126,59";
        else if(srm<=10.7) return "188,128,54";
        else if(srm<=10.8) return "190,124,55";
        else if(srm<=10.9) return "193,122,55";
        else if(srm<=11) return "190,124,55";
        else if(srm<=11.1) return "194,121,59";
        else if(srm<=11.2) return "193,120,56";
        else if(srm<=11.3) return "190,119,52";
        else if(srm<=11.4) return "182,117,54";
        else if(srm<=11.5) return "196,116,59";
        else if(srm<=11.6) return "191,118,56";
        else if(srm<=11.7) return "190,116,57";
        else if(srm<=11.8) return "191,115,58";
        else if(srm<=11.9) return "189,115,56";
        else if(srm<=12) return "191,113,56";
        else if(srm<=12.1) return "191,113,53";
        else if(srm<=12.2) return "188,112,57";
        else if(srm<=12.3) return "190,112,55";
        else if(srm<=12.4) return "184,110,52";
        else if(srm<=12.5) return "188,109,55";
        else if(srm<=12.6) return "189,109,55";
        else if(srm<=12.7) return "186,106,50";
        else if(srm<=12.8) return "190,103,52";
        else if(srm<=12.9) return "189,104,54";
        else if(srm<=13) return "188,103,51";
        else if(srm<=13.1) return "188,103,51";
        else if(srm<=13.2) return "186,101,51";
        else if(srm<=13.3) return "186,102,56";
        else if(srm<=13.4) return "185,100,56";
        else if(srm<=13.5) return "185,98,59";
        else if(srm<=13.6) return "183,98,54";
        else if(srm<=13.7) return "181,100,53";
        else if(srm<=13.8) return "182,97,55";
        else if(srm<=13.9) return "177,97,51";
        else if(srm<=14) return "178,96,51";
        else if(srm<=14.1) return "176,96,49";
        else if(srm<=14.2) return "177,96,55";
        else if(srm<=14.3) return "178,95,55";
        else if(srm<=14.4) return "171,94,55";
        else if(srm<=14.5) return "171,92,56";
        else if(srm<=14.6) return "172,93,59";
        else if(srm<=14.7) return "168,92,55";
        else if(srm<=14.8) return "169,90,54";
        else if(srm<=14.9) return "168,88,57";
        else if(srm<=15) return "165,89,54";
        else if(srm<=15.1) return "166,88,54";
        else if(srm<=15.2) return "165,88,58";
        else if(srm<=15.3) return "161,88,52";
        else if(srm<=15.4) return "163,85,55";
        else if(srm<=15.5) return "160,86,56";
        else if(srm<=15.6) return "158,85,57";
        else if(srm<=15.7) return "158,86,54";
        else if(srm<=15.8) return "159,84,57";
        else if(srm<=15.9) return "156,83,53";
        else if(srm<=16) return "152,83,54";
        else if(srm<=16.1) return "150,83,55";
        else if(srm<=16.2) return "150,81,56";
        else if(srm<=16.3) return "146,81,56";
        else if(srm<=16.4) return "147,79,54";
        else if(srm<=16.5) return "147,79,55";
        else if(srm<=16.6) return "146,78,54";
        else if(srm<=16.7) return "142,77,51";
        else if(srm<=16.8) return "143,79,53";
        else if(srm<=16.9) return "142,77,54";
        else if(srm<=17) return "141,76,50";
        else if(srm<=17.1) return "140,75,50";
        else if(srm<=17.2) return "138,73,49";
        else if(srm<=17.3) return "135,70,45";
        else if(srm<=17.4) return "136,71,49";
        else if(srm<=17.5) return "140,72,49";
        else if(srm<=17.6) return "128,70,45";
        else if(srm<=17.7) return "129,71,46";
        else if(srm<=17.8) return "130,69,47";
        else if(srm<=17.9) return "123,69,45";
        else if(srm<=18) return "124,69,45";
        else if(srm<=18.1) return "121,66,40";
        else if(srm<=18.2) return "120,67,40";
        else if(srm<=18.3) return "119,64,38";
        else if(srm<=18.4) return "116,63,34";
        else if(srm<=18.5) return "120,63,35";
        else if(srm<=18.6) return "120,62,37";
        else if(srm<=18.7) return "112,63,35";
        else if(srm<=18.8) return "111,62,36";
        else if(srm<=18.9) return "109,60,34";
        else if(srm<=19) return "107,58,30";
        else if(srm<=19.1) return "106,57,31";
        else if(srm<=19.2) return "107,56,31";
        else if(srm<=19.3) return "105,56,28";
        else if(srm<=19.4) return "105,56,28";
        else if(srm<=19.5) return "104,52,31";
        else if(srm<=19.6) return "102,53,27";
        else if(srm<=19.7) return "100,53,26";
        else if(srm<=19.8) return "99,52,25";
        else if(srm<=19.9) return "93,53,24";
        else if(srm<=20) return "93,52,26";
        else if(srm<=20.1) return "89,49,20";
        else if(srm<=20.2) return "90,50,21";
        else if(srm<=20.3) return "91,48,20";
        else if(srm<=20.4) return "83,48,15";
        else if(srm<=20.5) return "88,48,17";
        else if(srm<=20.6) return "86,46,17";
        else if(srm<=20.7) return "81,45,15";
        else if(srm<=20.8) return "83,44,15";
        else if(srm<=20.9) return "81,45,15";
        else if(srm<=21) return "78,42,12";
        else if(srm<=21.1) return "77,43,12";
        else if(srm<=21.2) return "75,41,12";
        else if(srm<=21.3) return "74,41,5";
        else if(srm<=21.4) return "78,40,23";
        else if(srm<=21.5) return "83,43,46";
        else if(srm<=21.6) return "78,43,41";
        else if(srm<=21.7) return "78,40,41";
        else if(srm<=21.8) return "76,41,41";
        else if(srm<=21.9) return "74,39,39";
        else if(srm<=22) return "74,39,39";
        else if(srm<=22.1) return "69,39,35";
        else if(srm<=22.2) return "70,37,37";
        else if(srm<=22.3) return "68,38,36";
        else if(srm<=22.4) return "64,35,34";
        else if(srm<=22.5) return "64,35,34";
        else if(srm<=22.6) return "62,33,32";
        else if(srm<=22.7) return "58,33,31";
        else if(srm<=22.8) return "61,33,31";
        else if(srm<=22.9) return "58,33,33";
        else if(srm<=23) return "54,31,27";
        else if(srm<=23.1) return "52,29,28";
        else if(srm<=23.2) return "52,29,28";
        else if(srm<=23.3) return "49,28,27";
        else if(srm<=23.4) return "48,27,26";
        else if(srm<=23.5) return "48,27,26";
        else if(srm<=23.6) return "44,25,25";
        else if(srm<=23.7) return "44,25,23";
        else if(srm<=23.8) return "42,24,26";
        else if(srm<=23.9) return "40,23,22";
        else if(srm<=24) return "38,23,22";
        else if(srm<=24.1) return "38,23,22";
        else if(srm<=24.2) return "38,23,22";
        else if(srm<=24.3) return "38,23,22";
        else if(srm<=24.4) return "38,23,22";
        else if(srm<=24.5) return "38,23,22";
        else if(srm<=24.6) return "38,23,22";
        else if(srm<=24.7) return "38,23,22";
        else if(srm<=24.8) return "38,23,22";
        else if(srm<=24.9) return "38,23,22";
        else if(srm<=25) return "38,23,22";
        else if(srm<=25.1) return "38,23,22";
        else if(srm<=25.2) return "38,23,22";
        else if(srm<=25.3) return "38,23,22";
        else if(srm<=25.4) return "38,23,22";
        else if(srm<=25.5) return "38,23,22";
        else if(srm<=25.6) return "38,23,24";
        else if(srm<=25.7) return "25,16,15";
        else if(srm<=25.8) return "25,16,15";
        else if(srm<=25.9) return "25,16,15";
        else if(srm<=26) return "25,16,15";
        else if(srm<=26.1) return "25,16,15";
        else if(srm<=26.2) return "25,16,15";
        else if(srm<=26.3) return "25,16,15";
        else if(srm<=26.4) return "25,16,15";
        else if(srm<=26.5) return "25,16,15";
        else if(srm<=26.6) return "25,16,15";
        else if(srm<=26.7) return "25,16,15";
        else if(srm<=26.8) return "25,16,15";
        else if(srm<=26.9) return "25,16,15";
        else if(srm<=27) return "25,16,15";
        else if(srm<=27.1) return "25,16,15";
        else if(srm<=27.2) return "25,16,15";
        else if(srm<=27.3) return "18,13,12";
        else if(srm<=27.4) return "18,13,12";
        else if(srm<=27.5) return "18,13,12";
        else if(srm<=27.6) return "18,13,12";
        else if(srm<=27.7) return "18,13,12";
        else if(srm<=27.8) return "18,13,12";
        else if(srm<=27.9) return "18,13,12";
        else if(srm<=28) return "18,13,12";
        else if(srm<=28.1) return "18,13,12";
        else if(srm<=28.2) return "18,13,12";
        else if(srm<=28.3) return "18,13,12";
        else if(srm<=28.4) return "18,13,12";
        else if(srm<=28.5) return "18,13,12";
        else if(srm<=28.6) return "18,13,12";
        else if(srm<=28.7) return "17,13,10";
        else if(srm<=28.8) return "18,13,12";
        else if(srm<=28.9) return "16,11,10";
        else if(srm<=29) return "16,11,10";
        else if(srm<=29.1) return "16,11,10";
        else if(srm<=29.2) return "16,11,10";
        else if(srm<=29.3) return "16,11,10";
        else if(srm<=29.4) return "16,11,10";
        else if(srm<=29.5) return "16,11,10";
        else if(srm<=29.6) return "16,11,10";
        else if(srm<=29.7) return "16,11,10";
        else if(srm<=29.8) return "16,11,10";
        else if(srm<=29.9) return "16,11,10";
        else if(srm<=30) return "16,11,10";
        else if(srm<=30.1) return "16,11,10";
        else if(srm<=30.2) return "16,11,10";
        else if(srm<=30.3) return "16,11,10";
        else if(srm<=30.4) return "16,11,10";
        else if(srm<=30.5) return "14,9,8";
        else if(srm<=30.6) return "15,10,9";
        else if(srm<=30.7) return "14,9,8";
        else if(srm<=30.8) return "14,9,8";
        else if(srm<=30.9) return "14,9,8";
        else if(srm<=31) return "14,9,8";
        else if(srm<=31.1) return "14,9,8";
        else if(srm<=31.2) return "14,9,8";
        else if(srm<=31.3) return "14,9,8";
        else if(srm<=31.4) return "14,9,8";
        else if(srm<=31.5) return "14,9,8";
        else if(srm<=31.6) return "14,9,8";
        else if(srm<=31.7) return "14,9,8";
        else if(srm<=31.8) return "14,9,8";
        else if(srm<=31.9) return "14,9,8";
        else if(srm<=32) return "15,11,8";
        else if(srm<=32.1) return "12,9,7";
        else if(srm<=32.2) return "12,9,7";
        else if(srm<=32.3) return "12,9,7";
        else if(srm<=32.4) return "12,9,7";
        else if(srm<=32.5) return "12,9,7";
        else if(srm<=32.6) return "12,9,7";
        else if(srm<=32.7) return "12,9,7";
        else if(srm<=32.8) return "12,9,7";
        else if(srm<=32.9) return "12,9,7";
        else if(srm<=33) return "12,9,7";
        else if(srm<=33.1) return "12,9,7";
        else if(srm<=33.2) return "12,9,7";
        else if(srm<=33.3) return "12,9,7";
        else if(srm<=33.4) return "12,9,7";
        else if(srm<=33.5) return "12,9,7";
        else if(srm<=33.6) return "12,9,7";
        else if(srm<=33.7) return "10,7,7";
        else if(srm<=33.8) return "10,7,5";
        else if(srm<=33.9) return "8,7,7";
        else if(srm<=34) return "8,7,7";
        else if(srm<=34.1) return "8,7,7";
        else if(srm<=34.2) return "8,7,7";
        else if(srm<=34.3) return "8,7,7";
        else if(srm<=34.4) return "8,7,7";
        else if(srm<=34.5) return "8,7,7";
        else if(srm<=34.6) return "8,7,7";
        else if(srm<=34.7) return "8,7,7";
        else if(srm<=34.8) return "8,7,7";
        else if(srm<=34.9) return "8,7,7";
        else if(srm<=35) return "8,7,7";
        else if(srm<=35.1) return "8,7,7";
        else if(srm<=35.2) return "8,7,7";
        else if(srm<=35.3) return "7,6,6";
        else if(srm<=35.4) return "7,6,6";
        else if(srm<=35.5) return "7,6,6";
        else if(srm<=35.6) return "7,6,6";
        else if(srm<=35.7) return "7,6,6";
        else if(srm<=35.8) return "7,6,6";
        else if(srm<=35.9) return "7,6,6";
        else if(srm<=36) return "7,6,6";
        else if(srm<=36.1) return "7,6,6";
        else if(srm<=36.2) return "7,6,6";
        else if(srm<=36.3) return "7,6,6";
        else if(srm<=36.4) return "7,6,6";
        else if(srm<=36.5) return "7,6,6";
        else if(srm<=36.6) return "7,6,6";
        else if(srm<=36.7) return "7,7,4";
        else if(srm<=36.8) return "6,6,3";
        else if(srm<=36.9) return "6,5,5";
        else if(srm<=37) return "4,5,4";
        else if(srm<=37.1) return "4,5,4";
        else if(srm<=37.2) return "4,5,4";
        else if(srm<=37.3) return "4,5,4";
        else if(srm<=37.4) return "4,5,4";
        else if(srm<=37.5) return "4,5,4";
        else if(srm<=37.6) return "4,5,4";
        else if(srm<=37.7) return "4,5,4";
        else if(srm<=37.8) return "4,5,4";
        else if(srm<=37.9) return "4,5,4";
        else if(srm<=38) return "4,5,4";
        else if(srm<=38.1) return "4,5,4";
        else if(srm<=38.2) return "4,5,4";
        else if(srm<=38.3) return "4,5,4";
        else if(srm<=38.4) return "4,5,4";
        else if(srm<=38.5) return "3,4,3";
        else if(srm<=38.6) return "4,5,4";
        else if(srm<=38.7) return "3,4,3";
        else if(srm<=38.8) return "3,4,3";
        else if(srm<=38.9) return "3,4,3";
        else if(srm<=39) return "3,4,3";
        else if(srm<=39.1) return "3,4,3";
        else if(srm<=39.2) return "3,4,3";
        else if(srm<=39.3) return "3,4,3";
        else if(srm<=39.4) return "3,4,3";
        else if(srm<=39.5) return "3,4,3";
        else if(srm<=39.6) return "3,4,3";
        else if(srm<=39.7) return "3,4,3";
        else if(srm<=39.8) return "3,4,3";
        else if(srm<=39.9) return "3,4,3";
        else return "3,4,3";
    }
    
    public static Color getColorFromRGB(final String rgbString){
        String[] rgb = rgbString.split(",");
        final int red = Integer.parseInt(rgb[0]);
        final int green = Integer.parseInt(rgb[1]);
        final int blue = Integer.parseInt(rgb[2]);
        final Color c = new Color(red, green, blue);
        return c;
    }
}
